package com.jia.product.entity;


import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.jia.commons.valid.AddGroup;
import com.jia.commons.valid.ListValue;
import com.jia.commons.valid.UpdateGroup;
import lombok.Getter;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.*;

import static com.jia.product.constants.ProductAttribute.PRODUCT_SALES_STATUS;
import static com.jia.product.constants.ProductAttribute.PRODUCT_UN_SALES_STATUS;

/**
 * 品牌(Brand)表实体类
 *
 * @author makejava
 * @since 2025-07-08 18:15:26
 */
@Getter
@SuppressWarnings("serial")
@TableName("pms_brand")
public class Brand extends Model<Brand> {
    //品牌id
    @TableId
    @Null(message = "新增主键id必须为空", groups = AddGroup.class)
    @NotNull(message = "修改需要主键id", groups = UpdateGroup.class)
    private Long brandId;
    //品牌名
    @NotBlank(message = "品牌名不可以为空", groups = {AddGroup.class, UpdateGroup.class})
    private String name;
    //品牌logo地址 支持多个条件
    @NotEmpty(message = "logo不可以为空")
    @URL(message = "logo必须是一个合法的Url")
    private String logo;
    //介绍
    private String descript;
    //显示状态[0-不显示；1-显示]
    @ListValue(values = {0, 1}, groups = {AddGroup.class})
    @TableLogic(value = PRODUCT_SALES_STATUS, delval = PRODUCT_UN_SALES_STATUS)
    private Integer showStatus;
    //检索首字母
    // 使用正则表达式
    @Pattern(regexp = "^[a-zA-Z]$", message = "检索首字母必须是一个字母")
    private String firstLetter;
    //排序
    private Integer sort;


    public void setBrandId(Long brandId) {
        this.brandId = brandId;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setLogo(String logo) {
        this.logo = logo;
    }

    public void setDescript(String descript) {
        this.descript = descript;
    }

    public void setShowStatus(Integer showStatus) {
        this.showStatus = showStatus;
    }

    public void setFirstLetter(String firstLetter) {
        this.firstLetter = firstLetter;
    }

    public void setSort(Integer sort) {
        this.sort = sort;
    }

}

